home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Menus / High Level / MenuSection.h < prev    next >
Encoding:
Text File  |  1997-06-28  |  716 b   |  38 lines  |  [TEXT/CWIE]

  1. // MenuSection.h
  2.  
  3. #ifndef MenuSection_h
  4. #define MenuSection_h
  5.  
  6. #ifndef Menu_h
  7. #include "Menu.h"
  8. #endif
  9.  
  10. class MenuSection
  11.   {
  12.     friend class SingleMenuItem;
  13.     friend class FixedMenuSection;
  14.     friend class ExtensibleMenuSection;
  15.     
  16.     private:
  17.         Menu& menu;
  18.         const uint16 firstItem;
  19.         const uint16 maxLength;
  20.         
  21.         enum Extensible { extensible };
  22.  
  23.         MenuSection( Menu&, uint16 length );
  24.         MenuSection( Menu&, Extensible );
  25.         
  26.     public:
  27.         MenuItem operator[]( uint16 i ) const
  28.             { Assert( i < maxLength ); return menu[ firstItem + i ]; }
  29.         
  30.         uint16 FirstItem() const        { return firstItem; }
  31.         uint16 MaxLength() const        { return maxLength; }
  32.         
  33.         virtual void Prepare() = 0;
  34.         virtual void Choose( uint16 ) = 0;
  35.   };
  36.  
  37. #endif
  38.